The Property Sheet

To display the property sheet for a component, either double-click on it, or select it and then select Properties from the Object menu or the Property Sheet icon () from the toolbar.


To change a property simply click on the property. At the bottom of the window the edit area will appear and allow you to set the property.

There are three common properties of each component: Variable Name, Variable Scope, and Object Initialization.


Variable name is the name used to refer to the component in the generated code.
Variable scope provides a means of controlling the declaration scope of a component. If Instance variable is selected, then you are offered the choice of access restrictions.
Object Initialization enables you to control the way in which the object is initialized. You can choose between:
New
Beans instantiation
Code Expression
Variable Name
No Initialisation
Deserialization

For other properties the Choice box at the top of the edit area will usually offer three ways to specify the property:

Value
Code Expression
Variable Name
For properties whose type is java.awt.Image or com.sun.java.swing.Icon there is an additional specification called Image resource or Swing ImageIcon resource.

New

This is the default for object initialisation, and results in the object being initialised via the use of new.

Beans instantiation

This results in the object being initialised via the use of Beans.instantiate().

No Initialization

This means that no initialization code is generated for the object. This allows you to reference an object that is created within another method.

Deserialization

This results in the object being created from a serialized file. Note that this option is not available for Swing components that are composites, e.g. JFrame. For more details see deserialization.

Value

This is where a simple value is used to set the property. If you were setting a label property on a Button, then you would enter text here. If on the other hand, you were setting a boolean (True/False) value (e.g. Resizable on a Frame), then a choice would be offered to you of either True or False. Many of the properties in the Property Sheet have their own way of setting their properties. Examples of these are: size, foreground, and font.
You will find that third party components will provide their own way of setting the properties on their components.

Variable Name

Here you may specify the name of a variable, of the same type, to set this property. An example of when you might do this is with CheckboxGroups. The variable name is not used dynamically inside Visaj yet, but you will see its effect when the generated code is run.

Code Expression

You may enter any valid Java code expression which returns a value of the correct type. You may use this when the property depends on the property of another component, e.g. for making the 'title' of a Frame equal to the 'label' of the Button that was just pressed:

selectedButton.getLabel()
Again, the code expression is not used dynamically inside Visaj, but you will see its effect when the generated code is run.

Image resource and Swing ImageIcon resource

Both of these allow you to specify image resources. You specify a file that is used by the dynamic display in the Design-time file: field, and a resource path that is used in the generated code in the Runtime resource path: field. For more details please see the Visaj User's Guide.

Reset to Default Value

At the bottom of the editing area there is a Reset to default value button. If you have changed the selected value in the property sheet, Reset to Default Value sets the value back to the default.

Undo and Close

At the bottom of the property sheet there is an Undo button and a Close button. Undo undoes the last change made in the current property sheet. Close closes the property sheet.